package com.cryptoneedle.garden.vo;


import com.cryptoneedle.garden.enums.MappingFieldType;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * <p>description: 标准表配置 </p>
 *
 * @author CryptoNeedle
 * @date 2025-09-26
 */
@Data
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
public class MappingTableCreateVo {

    @NotBlank(message = "表名称不能为空")
    @Schema(description = "表名称")
    private String tableName;

    @NotBlank(message = "表注释不能为空")
    @Schema(description = "表注释")
    private String tableComment;

    @NotEmpty(message = "列配置不能为空")
    @Schema(description = "列配置")
    private List<ColumnConfig> columnConfigs;

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Accessors(chain = true)
    @ToString
    public static class ColumnConfig {

        @NotBlank(message = "列名称不能为空")
        @Schema(description = "列名称")
        private String columnName;

        @NotBlank(message = "列注释不能为空")
        @Schema(description = "列注释")
        private String columnComment;

        @Schema(description = "列类型")
        private MappingFieldType mappingFieldType;

        @Schema(description = "列排序")
        private Integer sequence;
    }
}